package java6681.module;

public class StoreList6681 {
    public static void main(String[] args) {
        // 苹果笔记本电脑
        String macBrand = "MacBookAir";
        double macSize = 13.3;
        double macPrice = 6988.88;
        String macConfig = "i5处理器4GB内存128G固态硬盘";
        int macCount = 5;
        // 联想Thinkpad笔记本电脑
        String thinkpadBrand = "ThinkpadT450";
        double thinkpadSize = 14.0;
        double thinkpadPrice = 5999.99;
        String thinkpadConfig = "i5处理器4GB内存500G硬盘";
        int thinkpadCount = 10;
        // 华硕ASUS笔记本电脑
        String ASUSBrand = "ASUS-FL5800";
        double ASUSSize = 15.6;
        double ASUSPrice = 4999.50;
        String ASUSConfig = "i7处理器4GB内存128G固态硬盘";
        int ASUSCount = 18;

        top6681();

        String[] brand = {macBrand,thinkpadBrand,ASUSBrand};
        double[] size = {macSize,thinkpadSize,ASUSSize};
        double[] price = {macPrice,thinkpadPrice,ASUSPrice};
        String[] config = {macConfig,thinkpadConfig,ASUSConfig};
        int[] count = {macCount,thinkpadCount,ASUSCount};

        list6681(brand,size,price,config,count);

        bottom6681(macCount,thinkpadCount,ASUSCount,macPrice,thinkpadPrice,ASUSPrice);

    }
        // 列表顶部
        public static void top6681(){

            System.out.println("------------------------------商城库存清单"
                    + "-----------------------------");
            System.out.println("品牌型号		尺寸	价格		配置		库存数");
        }
        //列表中部
        public static void list6681(String[] brand,double[] size,double[] price, String[] config,int[] count){
            for (int i = 0;i < 3;i++){
                System.out.printf("%-15s %-7s %-9s %-20s %-1s\n",brand[i],size[i],price[i],config[i],count[i]);
            }
    }
        // 列表底部
        public static void bottom6681(int macCount, int thinkpadCount,int ASUSCount,double macPrice,double thinkpadPrice,double ASUSPrice){
            // 统计总库存数、库存总金额
            int totalCount = macCount + thinkpadCount + ASUSCount;
            double totalMoney = (macCount * macPrice)
                    + (thinkpadCount * thinkpadPrice) + (ASUSCount * ASUSPrice);

            System.out.println("--------------------"
                    + "-----------------------------------------------");
            System.out.println("总库存数：" + totalCount);
            System.out.println("库存商品总金额：" + totalMoney);
    }
}
